package com.test.aop.aspect;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

@Slf4j
@Aspect
@Component
public class MyAOPAspect {

    @Around("@annotation(org.springframework.web.bind.annotation.RequestMapping)")
    public Object doAroundRequestMapping(ProceedingJoinPoint joinPoint) throws Throwable {
        log.info("Around RequestMapping before....");
        Object result = joinPoint.proceed();
        log.info("Around RequestMapping after....");
        return result;
    }

    @Around("@annotation(com.test.aop.config.MyAOP)")
    public Object doAround(ProceedingJoinPoint joinPoint) throws Throwable {
        log.info("Around before....");
        Object result = joinPoint.proceed();
        log.info("Around after....");
        return result;
    }


}
